package com.wuditp.smile.core.domain;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * 字典对象基类
 * 
 * @author kevin.tao
 * 
 */
@Entity
@Table(name = "c_common_category")
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "dict_category", discriminatorType = DiscriminatorType.STRING)
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public abstract class DomainCategory extends DomainInstance implements UnDeletable {

	private static final long serialVersionUID = 966876008964722113L;

	/**
	 * 描述
	 */
	@Column(name = "entity_desc")
	protected String descrption;

	/**
	 * 优先级
	 */
	@Column(name = "priority")
	protected Integer priority;

	/**
	 * 删除标记
	 */
	@Column(name = "is_deleted")
	protected Boolean isDeleted = Boolean.FALSE;

	public String getDescrption() {
		return descrption;
	}

	public void setDescrption(String descrption) {
		this.descrption = descrption;
	}

	public Integer getPriority() {
		return priority;
	}

	public void setPriority(Integer priority) {
		this.priority = priority;
	}

	public Boolean getIsDeleted() {
		return isDeleted;
	}

	public void setIsDeleted(Boolean isDeleted) {
		this.isDeleted = isDeleted;
	}

	@Override
	public boolean isDeleted() {
		return null == this.isDeleted ? false : this.isDeleted.booleanValue();
	}

	@Override
	public void markedAsAvailable() {
		this.isDeleted = Boolean.TRUE;
	}

	@Override
	public void markedAsDeleted() {
		this.isDeleted = Boolean.FALSE;
	}
}
